#include "lcd.h"
#include "dcmi.h"
#include "ov2640.h"
#include "ov2640_user_drv.h"


void ov2640_user_init(void)
{
	ov2640_init();
	ov2640_flash_intctrl();
	ov2640_rgb565_mode();
	ov2640_outsize_set(lcddev.width, lcddev.height);
	ov2640_start_Transmit((uint8_t *)&LCD->LCD_RAM,(lcddev.height * lcddev.width)*2);
}

	
void ov2640_start_Transmit(uint8_t *transmit_buff,uint32_t buff_size)
{
		lcd_setPos(0,0);
		__HAL_DCMI_ENABLE_IT(&hdcmi, DCMI_IT_FRAME);   
		HAL_DCMI_Start_DMA(&hdcmi,DCMI_MODE_CONTINUOUS,(uint32_t)transmit_buff,buff_size/4);
}


void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
{
	if(hdcmi->Instance == DCMI)
	{
		lcd_setPos(0,0);
	}
}
